3.671 \(\int \frac{(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx\)

Optimal. Leaf size=54 \[ \frac{a (A-i B)}{c f (\tan (e+f x)+i)}+\frac{a B \log (\cos (e+f x))}{c f}+\frac{i a B x}{c} \]

[Out]

(I*a*B*x)/c + (a*B*Log[Cos[e + f*x]])/(c*f) + (a*(A - I*B))/(c*f*(I + Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.0880086, antiderivative size = 54, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 39, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.051, Rules used = {3588, 43} \[ \frac{a (A-i B)}{c f (\tan (e+f x)+i)}+\frac{a B \log (\cos (e+f x))}{c f}+\frac{i a B x}{c} \]

Antiderivative was successfully verified.

[In]

Int[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]),x]

[Out]

(I*a*B*x)/c + (a*B*Log[Cos[e + f*x]])/(c*f) + (a*(A - I*B))/(c*f*(I + Tan[e + f*x]))

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int \frac{(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx &=\frac{(a c) \operatorname{Subst}\left (\int \frac{A+B x}{(c-i c x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left (\frac{-A+i B}{c^2 (i+x)^2}-\frac{B}{c^2 (i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{i a B x}{c}+\frac{a B \log (\cos (e+f x))}{c f}+\frac{a (A-i B)}{c f (i+\tan (e+f x))}\\ \end{align*}

Mathematica [B]  time = 1.74528, size = 123, normalized size = 2.28 \[ \frac{a (\sin (e+f x)-i \cos (e+f x)) \left (\cos (e+f x) \left (A+i B \log \left (\cos ^2(e+f x)\right )-4 B f x-i B\right )+\sin (e+f x) \left (i A+B \log \left (\cos ^2(e+f x)\right )+4 i B f x+B\right )+2 B \tan ^{-1}(\tan (2 e+f x)) (\cos (e+f x)-i \sin (e+f x))\right )}{2 c f} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]),x]

[Out]

(a*((-I)*Cos[e + f*x] + Sin[e + f*x])*(Cos[e + f*x]*(A - I*B - 4*B*f*x + I*B*Log[Cos[e + f*x]^2]) + 2*B*ArcTan
[Tan[2*e + f*x]]*(Cos[e + f*x] - I*Sin[e + f*x]) + (I*A + B + (4*I)*B*f*x + B*Log[Cos[e + f*x]^2])*Sin[e + f*x
]))/(2*c*f)

________________________________________________________________________________________

Maple [A]  time = 0.038, size = 64, normalized size = 1.2 \begin{align*}{\frac{-iBa}{cf \left ( \tan \left ( fx+e \right ) +i \right ) }}+{\frac{Aa}{cf \left ( \tan \left ( fx+e \right ) +i \right ) }}-{\frac{aB\ln \left ( \tan \left ( fx+e \right ) +i \right ) }{cf}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x)

[Out]

-I/f*a/c/(tan(f*x+e)+I)*B+1/f*a/c/(tan(f*x+e)+I)*A-1/f*a/c*B*ln(tan(f*x+e)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.45096, size = 112, normalized size = 2.07 \begin{align*} \frac{{\left (-i \, A - B\right )} a e^{\left (2 i \, f x + 2 i \, e\right )} + 2 \, B a \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{2 \, c f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*((-I*A - B)*a*e^(2*I*f*x + 2*I*e) + 2*B*a*log(e^(2*I*f*x + 2*I*e) + 1))/(c*f)

________________________________________________________________________________________

Sympy [A]  time = 1.52932, size = 90, normalized size = 1.67 \begin{align*} \frac{B a \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c f} + \begin{cases} \frac{\left (- i A a e^{2 i e} - B a e^{2 i e}\right ) e^{2 i f x}}{2 c f} & \text{for}\: 2 c f \neq 0 \\\frac{x \left (A a e^{2 i e} - i B a e^{2 i e}\right )}{c} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x)

[Out]

B*a*log(exp(2*I*f*x) + exp(-2*I*e))/(c*f) + Piecewise(((-I*A*a*exp(2*I*e) - B*a*exp(2*I*e))*exp(2*I*f*x)/(2*c*
f), Ne(2*c*f, 0)), (x*(A*a*exp(2*I*e) - I*B*a*exp(2*I*e))/c, True))

________________________________________________________________________________________

Giac [B]  time = 1.54162, size = 184, normalized size = 3.41 \begin{align*} -\frac{\frac{2 \, B a \log \left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}{c} - \frac{B a \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{c} - \frac{B a \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{c} - \frac{3 \, B a \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 2 \, A a \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 8 i \, B a \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 3 \, B a}{c{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}^{2}}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

-(2*B*a*log(tan(1/2*f*x + 1/2*e) + I)/c - B*a*log(abs(tan(1/2*f*x + 1/2*e) + 1))/c - B*a*log(abs(tan(1/2*f*x +
 1/2*e) - 1))/c - (3*B*a*tan(1/2*f*x + 1/2*e)^2 - 2*A*a*tan(1/2*f*x + 1/2*e) + 8*I*B*a*tan(1/2*f*x + 1/2*e) -
3*B*a)/(c*(tan(1/2*f*x + 1/2*e) + I)^2))/f